﻿<!DOCTYPE html>
<html>
<head>
	<script>
		var a = '<div id="loading" class="shade" times="1" style="background-color:#212121; opacity:1; z-index:10000; filter:alpha(opacity=30);"><div style="color:white; text-align:center;">页面加载中，请等待...</div></div>';
		document.write(a);
		document.onreadystatechange = completeLoading;

		//加载状态为complete时移除loading效果
		function completeLoading() {
			if (document.readyState == "complete") {
				document.body.removeChild(document.getElementById("loading"));
			}
		}
	</script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>执行自定义代码</title>
	<!-- Loading Bootstrap -->
	<link href="~/sRaw/ui/css/bootstrap.min.css" rel="stylesheet">

	<link rel="shortcut icon" href="~/sRaw/ui/img/favicon.ico">

	<style>
		body:before {
			content: ' ';
			position: fixed;
			z-index: -1;
			top: 0;
			right: 0;
			bottom: 0;
			left: 0;
			background: url("/sRaw/ui/img/back.jpg") 50% 0 repeat-y;
			background-size: cover;
		}

		body {
			background-image: url("/sRaw/ui/img/back.jpg");
			background-repeat: no-repeat;
			background-position: center top;
			background-size: cover;
			background-attachment: fixed;
			width: 800px;
			margin-left: auto;
			margin-right: auto;
		}

		.toend {
			position: absolute;
			margin: 0;
			padding: 0;
			width: 100%;
			height: 100%;
		}

		.shade {
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			position: fixed;
			_position: absolute;
			pointer-events: auto;
		}
	</style>
</head>
<body>
	<div class="modal fade in" id="result" tabindex="-1" role="dialog" aria-labelledby="result" style="opacity:0.9">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">执行结果</h4>
				</div>
				<div class="modal-body" id="resultbody">
					<span class="label label-danger">执行结果：</span><br/>
					<div style="margin-top:10px"></div>
					<textarea type="text" class="input form-control" style="resize:none;min-height:320px" id="coderesult">
					</textarea>
				</div>
			</div>
		</div>
	</div>
	<div class="panel panel-default" style="margin-left: 5%;margin-right: 5%;margin-top: 10px;opacity:0.9">
		<div class="panel-heading">
			<span class="label label-success" style="float:right">开发者功能</span>
			<strong>执行任意代码(C#)</strong>
		</div>
		<div class="panel-body">
			<span class="label label-danger">不要执行恶意代码哦~</span>
		</div>
		<div class="panel-footer">
			<div class="input-group-hg">
				<div class="input-group-addon" style="color:#169AC3!important;text-align:left!important">
					using System;<br/>
					using System.Data;<br />
					using System.Collections.Generic;<br />
					using System.IO;<br />
					using System.Threading;<br />
					using System.Text;<br /><br />
					using CardWarWEB;<br />
					<br />
					namespace EvalClass {<br /><br />
					<span style="margin-left:30px">public class _ClassEvaluatorCompiler</span><br />
					<span style="margin-left:30px">{</span><br />
				</div>
				<textarea type="text" class="input form-control" style="resize:none;min-height:320px;padding-left:80px" id="coding">
public object Run() {
	
	return "Test";
	
}
				</textarea>
				<div class="input-group-addon" style="color:#169AC3!important;text-align:left!important">
					<span style="margin-left:30px">}</span><br/>
					}
				</div>
			</div><br />
			<input type="text" placeholder="运行函数名" class="input form-control" style="margin-bottom:10px" id="functionname" value="Run" />
			<button type="button" class="btn btn-primary" style="margin-top:10px;width:100%" id="release">编译/执行</button>
		</div>
	</div>
	<script src="~/sRaw/ui/js/jquery.min.js"></script>
	<script src="~/sRaw/layer/layer.js"></script>
	<script src="~/sRaw/ui/js/bootstrap.min.js"></script>
	<script>
		$("#release").click(function () {
			$("#coderesult").val("");
			var skzy0 = 0;
			var code = $("#coding").val();
			var run = $("#functionname").val();
			var post = {};
			post["skzy0"] = skzy0;
			post["code"] = code;
			post["run"] = run;
			$.post("./Coding", post, function (data) {
				if (data == "Error")
					$("#coderesult").val("执行失败！参数不正确。");
				else
					$("#coderesult").val(data);

				$("#result").modal({
					backdrop: 'static'
				});
			});


		});


	</script>
</body>
</html>